package com.cskaoyan.wx.controller;

import com.cskaoyan.vo.BaseRespVo;
import com.cskaoyan.wx.bean.vo.WxSearchIndexVo;
import com.cskaoyan.wx.service.WxSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ description:
 * @ author:台
 **/

@RestController
public class WxSearchController {

    @Autowired
    WxSearchService wxSearchService;

    @RequestMapping("wx/search/index")
    public BaseRespVo wxSearchIndex(){
        WxSearchIndexVo wxSearchIndexVo = wxSearchService.searchIndex();
        return BaseRespVo.ok(wxSearchIndexVo);
    }

    @RequestMapping("wx/search/helper")
    public BaseRespVo wxSearchHelper(String keyword){
        List<String> data = wxSearchService.searchHelper(keyword);
        return BaseRespVo.ok(data);
    }

    @RequestMapping("wx/search/clearhistory")
    public BaseRespVo wxSearchClearHistory(){
        wxSearchService.clearHistory();
        return BaseRespVo.ok();
    }
}
